/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ronsicecream.pos.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author user
 */
@Entity
@Table(name = "pos_transaction_opname_item_detail")
@XmlRootElement
//@NamedQueries({
//    @NamedQuery(name = "PosTransactionOpnameItemDetail.findAll", query = "SELECT p FROM PosTransactionOpnameItemDetail p"),
//    @NamedQuery(name = "PosTransactionOpnameItemDetail.findBySync", query = "SELECT p FROM PosTransactionOpnameItemDetail p WHERE p.sync = :sync"),
//    @NamedQuery(name = "PosTransactionOpnameItemDetail.findByOpnameDetailId", query = "SELECT p FROM PosTransactionOpnameItemDetail p WHERE p.opnameDetailId = :opnameDetailId"),
//    @NamedQuery(name = "PosTransactionOpnameItemDetail.findByOpnameDetailOldValue", query = "SELECT p FROM PosTransactionOpnameItemDetail p WHERE p.opnameDetailOldValue = :opnameDetailOldValue"),
//    @NamedQuery(name = "PosTransactionOpnameItemDetail.findByOpnameDetailNewValue", query = "SELECT p FROM PosTransactionOpnameItemDetail p WHERE p.opnameDetailNewValue = :opnameDetailNewValue")})
public class PosTransactionOpnameItemDetail implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "opname_detail_id")
    private Integer opnameDetailId;
    @Column(name = "opname_detail_old_value")
    private BigDecimal opnameDetailOldValue;
    @Column(name = "opname_detail_new_value")
    private BigDecimal opnameDetailNewValue;
    @Lob
    @Column(name = "opname_detail_description")
    private String opnameDetailDescription;
    @JoinColumn(name = "opname_detail_opname_id", referencedColumnName = "opname_id")
    @ManyToOne(optional = false)
    private PosTransactionOpnameItem opnameDetailOpnameId;
    @JoinColumn(name = "opname_detail_status_id", referencedColumnName = "status_id")
    @ManyToOne(optional = false)
    private PosMasterStatus opnameDetailStatusId;
    
    @JoinColumn(name = "opname_detail_item_id", referencedColumnName = "item_id")
    @ManyToOne(optional = false)
    private PosMasterItem opnameDetailItemId;

    public PosTransactionOpnameItemDetail() {
    }

    public PosTransactionOpnameItemDetail(Integer opnameDetailId) {
        this.opnameDetailId = opnameDetailId;
    }

    public PosTransactionOpnameItemDetail(Integer opnameDetailId, String sync) {
        this.opnameDetailId = opnameDetailId;
        this.sync = sync;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getOpnameDetailId() {
        return opnameDetailId;
    }

    public void setOpnameDetailId(Integer opnameDetailId) {
        this.opnameDetailId = opnameDetailId;
    }

    public BigDecimal getOpnameDetailOldValue() {
        return opnameDetailOldValue;
    }

    public void setOpnameDetailOldValue(BigDecimal opnameDetailOldValue) {
        this.opnameDetailOldValue = opnameDetailOldValue;
    }

    public BigDecimal getOpnameDetailNewValue() {
        return opnameDetailNewValue;
    }

    public void setOpnameDetailNewValue(BigDecimal opnameDetailNewValue) {
        this.opnameDetailNewValue = opnameDetailNewValue;
    }

    public String getOpnameDetailDescription() {
        return opnameDetailDescription;
    }

    public void setOpnameDetailDescription(String opnameDetailDescription) {
        this.opnameDetailDescription = opnameDetailDescription;
    }

    public PosTransactionOpnameItem getOpnameDetailOpnameId() {
        return opnameDetailOpnameId;
    }

    public void setOpnameDetailOpnameId(PosTransactionOpnameItem opnameDetailOpnameId) {
        this.opnameDetailOpnameId = opnameDetailOpnameId;
    }

    public PosMasterStatus getOpnameDetailStatusId() {
        return opnameDetailStatusId;
    }

    public void setOpnameDetailStatusId(PosMasterStatus opnameDetailStatusId) {
        this.opnameDetailStatusId = opnameDetailStatusId;
    }

   

    public PosMasterItem getOpnameDetailItemId() {
        return opnameDetailItemId;
    }

    public void setOpnameDetailItemId(PosMasterItem opnameDetailItemId) {
        this.opnameDetailItemId = opnameDetailItemId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (opnameDetailId != null ? opnameDetailId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosTransactionOpnameItemDetail)) {
            return false;
        }
        PosTransactionOpnameItemDetail other = (PosTransactionOpnameItemDetail) object;
        if ((this.opnameDetailId == null && other.opnameDetailId != null) || (this.opnameDetailId != null && !this.opnameDetailId.equals(other.opnameDetailId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.buanalintas.ronsicecream.pos.entities.PosTransactionOpnameItemDetail[ opnameDetailId=" + opnameDetailId + " ]";
    }
    
}
